package com.example.utils;

import java.util.NoSuchElementException;
import java.util.Scanner;

public class InputHelper {
    /**
     * 从命令行获取一行输入
     * @param prompt 提示字符串
     * @return 用户输入的一行字符
     */
    public static String getLine(String prompt) {
        System.out.println(prompt);
        Scanner scanner = new Scanner(System.in);

        String line = null;
        try {
            line = scanner.nextLine();
            scanner.close();
        } catch (NoSuchElementException ignore) {}
        return line;
    }
}
